---
title: Create a log
description: Learn how to create a log with the Latitude SDK
---

## Prompt

In this example, the specific prompt is not important—you just need to have a prompt created in a Latitude project.

<CodeGroup>
```markdown example
---
provider: Latitude
model: gpt-4o-mini
---

You can upload logs to your Latitude.
More info: https://docs.latitude.so/guides/sdk/typescript#creating-logs

Once you upload a log you can see it in the logs section of this prompt.
```
</CodeGroup>

## Code

Here’s how you can upload a log to your prompt using the Latitude SDK:

<CodeGroup>
````typescript Typescript
import { Latitude } from '@latitude-data/sdk'
import { MessageRole, ContentType } from 'promptl-ai'

async function run() {
  const sdk = new Latitude(process.env.LATITUDE_API_KEY, {
    projectId: Number(process.env.PROJECT_ID),
    versionUuid: 'live',
  })

  const response = await sdk.logs.create(
    'create-log/example',
    [
      {
        role: MessageRole.user,
        content: [
          { type: 'text', text: 'Tell me a joke about Python' },
        ],
      },
      {
        role: MessageRole.assistant,
        content: [
          { type: 'text', text: 'Python is a great language!' },
        ],
      },
      {
        role: MessageRole.user,
        content: [
          { type: 'text', text: 'Tell me a joke about javascript!' },
        ],
      },
    ],
    {
      response: 'Javascript is a great language!',
    },
  )

  console.log('Log: ', response)
}

run()
````
````python Python
import asyncio
import os
from devtools import pprint

from latitude_sdk import (
    Latitude,
    LatitudeOptions,
    CreateLogOptions,
)
from promptl_ai import AssistantMessage, UserMessage


async def run():
    api_key = os.getenv("LATITUDE_API_KEY")
    sdk_options = LatitudeOptions(
        project_id=int(os.getenv("PROJECT_ID")),
        version_uuid="live",
    )
    sdk = Latitude(api_key, sdk_options)
    result = await sdk.logs.create(
        "create-log/example",
        [
            UserMessage(content="Tell me a joke about Python!"),
            AssistantMessage(content="Python is a great language!"),
            UserMessage(content="Tell me a joke about JavaScript!"),
        ],
        CreateLogOptions(
            response="JavaScript is a great language too!",
        ),
    )

    pprint(result)


asyncio.run(run())
````
</CodeGroup>
